<%@page import="java.util.List"%>
<%@page import="cn.school.servies.*,cn.school.entity.*"%>

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="jquery-3.4.1.js"></script>
</head>
<body>
<%@include file="includ.jsp" %>
<form action="addStudent.jsp" method="post" enctype="multipart/form-data">
<p>

	<label>姓名</label>
	<input type="text" required name="sname"/>
	
	</p>
	<p>
	<label>性别</label>
	<input type="checkbox"  name="sex" value="男"/>男
	<input type="checkbox"  name="sex" value="女"/>女
	</p>
	<p>
	<label>电话</label>
	<input type="text" required name="telephone"/>
	</p>
	<p>
	<label>qq</label>
	<input type="text" required name="qq"/>
	</p>
	<p>
	<label>微信</label>
	<input type="text" required name="wechat"/>
	</p>
	<p>
	<label>年级</label>
	
	<select required name="gradeid">
	<%
	GradeSerive ss=new GradeSerive();
	List<Grade> list=ss.findAll();
	for(Grade g:list){
	%>
	<option><%=g.getId() %></option>
	<%} %>
	</select>
	</p>
	<p>
	<label>入学日期</label>
	<input type="text" required name="enterdate"/>
	</p>
	<p>
	<label>来自哪个城市</label>
	<input type="text" required name="fromcity"/>
	</p>
	<p>
	<label>生日</label>
	<input type="text" required name="birthday"/>
	</p>
	<p>
	<label>地址</label>
	<input type="text" required name="address"/>
	</p>
	<p>
	<label>密码</label>
	<input type="text" required name="pass"/>
	</p>
		<p>
	<label>照片</label>
	<input type="file" id="file"  onchange="changepic(this)" name="pic" accept=""/> 
	<div id="IDcardShow">
	</div>
	<img id="photo" src="">	
	</p>
	<p>
    <input type="submit" value="新增"/>
   </p>
</form>
</body>
<script type="text/javascript">
function changepic(obj) {
	 document.getElementById("photo").src= window.webkitURL.createObjectURL(obj.files[0]);
}

/* 
var reader = new FileReader();
reader.onload = (function (file) {
    return function (e) {
        var datainfo = this.result;
        $("#IDcardShow").css({
             "background": "url(" + datainfo + ") center center no-repeat",
             "background-size": "cover"
        });
   };
})(e.target.files[0]);
reader.readAsDataURL(e.target.files[0]); */



</script>
</html>